from selenium.webdriver.common.by import By
from Base.Base import Base

class role(Base):
    dianji_loc = (By.XPATH, '//*[@id="sidebar"]/div[2]/div[1]/h2')
    juese_loc = (By.XPATH, '//*[@id="sidebar"]/div[2]/div[2]/ul/li[3]/div/a')
    tianjia_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[1]/ul/li/a/span')
    tianjia_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[1]/ul/li/a/span')
    sahnchu_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[4]')
    xiugai_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[3]')
    #分配菜单
    fenpei_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[3]')
    fenpeixuanxian_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[2]')
    zuixiao_loc = (By.XPATH, '/html/body/div[13]/div[1]/div/div/a[4]')
    cha_loc = (By.XPATH, '/html/body/div[13]/div[1]/div/div/a[1]')
    #修改内容
    xiugaineir_loc = (By.XPATH, '//*[@id="form"]/div[1]/p[3]/textarea')
    #保存
    baocun_loc = (By.XPATH, '//*[@id="form"]/div[2]/ul/li[1]/div/div/button')
    #添加名称
    mc_lo = (By.XPATH, '//*[@id="form"]/div[1]/p[1]/input')
    #输入编码
    bm_loc = (By.XPATH, '//*[@id="form"]/div[1]/p[2]/input')
    #输入描述
    miaoshu_loc = (By.XPATH, '//*[@id="form"]/div[1]/p[3]/textarea')
    #添加保存
    baocc = (By.XPATH, '//*[@id="form"]/div[2]/ul/li[1]/div/div/button')
    #全选
    quanxuan_loc = (By.XPATH, '//*[@id="selectAll"]')
    #分配权限
    fpqx_loc = (By.XPATH, '//*[@id="navTab"]/div[2]/div[2]/div[2]/div[2]/div[2]/div/table/tbody/tr[1]/td[6]/div/a[2]')
    #修改(缩小)
    xs_loc = (By.XPATH, '//*[@id="input"]/div[1]/span')
    # 修改(最小化)
    zxh_loc = (By.XPATH, '/html/body/div[13]/div[1]/div/div/a[4]')
    #取消
    quxiao_loc=(By.XPATH,'//*[@id="alertMsgBox"]/div[1]/div/div[2]/ul/li[2]/a/span')
    #确定删除
    queding_loc=(By.XPATH,'//*[@id="alertMsgBox"]/div[1]/div/div[2]/ul/li[1]/a/span')

    def dianji(self):
        """
        #点击权限管理
        :return:
        """
        try:
            self.click(self.dianji_loc)
        except Exception as e:
            print(e)

    def juese(self):
        """
         #点击角色
        :return:
         """
        try:
            self.click(self.juese_loc)
        except Exception as e:
            print(e)


    def tianjia(self):
        """
        #点击角色添加
       :return:
        """
        try:
            self.click(self.tianjia_loc)
        except Exception as e:
            print(e)

    def sahnchu(self):
        """
        删除
        :return:
        """
        try:
            self.click(self.sahnchu_loc)
        except Exception as e:
            print(e)
        # 点击修改
    def quxiao(self):
        """
        取消
        :return:
        """
        try:
            self.click(self.quxiao_loc)
        except Exception as e:
            print(e)

    def xiugai(self):
        """
        点击修改
        :param self:
        :return:
        """
        try:
            self.click(self.xiugai_loc)
        except Exception as e:
            print(e)




    def fenpei(self):
        """
           # 点击分配菜单
        :return:
        """
        try:

            self.click(self.fenpei_loc)
        except Exception as e:
            print(e)


    def fenpeiquanxian(self):
        """
         点击分配权限
        :return:
        """
        try:
            self.click(self.fenpeixuanxian_loc)
        except Exception as e:
            print(e)





    def zuixiao(self):
        """
         # 最小化
        :return:
        """
        try:
            self.click(self.zuixiao_loc)
        except Exception as e:
            print(e)

    def queding(self):
        try:
            self.click(self.queding_loc)
        except Exception as e:
            print(e)



    def cha(self):
        """
          # x
        :return:
        """
        try:
            self.click(self.cha_loc)
        except Exception as e:
            print(e)




    def xiugainr(self):
        """
         #修改
        :return:
        """
        try:
         self.send_keys(self.xiugaineir_loc,'564864')
        except Exception as e:
            print(e)





    def baocun(self):
        """
        保存
        :return:
        """
        try:
            self.click(self.baocun_loc)
        except Exception as e:
            print(e)



    def mc(self):
        """
        #输入角色名称
        :return:
        """
        try:

            self.send_keys(self.mc_lo,'47846545')
        except Exception as e:
            print(e)


    def bm(self):
        """
        #输入编码
        :return:
        """
        try:
            self.send_keys(self.bm_loc, '456451')
        except Exception as e:
            print(e)


    def miaoshu(self):
        """
            #描述
        :return:
        """
        try:
            self.send_keys(self.miaoshu_loc, '48445645dcffcd')
        except Exception as e:
            print(e)

    #保存

    def baocc(self):
        """
        保存
        :return:
        """
        try:
            self.click(self.baocc)
        except Exception as e:
            print(e)



    def quanxuan(self):
        """
          # 全选

        :return:
        """
        try:

            self.click(self.quanxuan_loc)
        except Exception as e:
            print(e)



    def fpqx(self):
        """
        # 点击分配权限
        :param self:
        :return:
        """
        try:
            self.click(self.fpqx_loc)
        except Exception as e:
            print(e)





    def xs(self):
        """
        # 最小化
        :return:
        """
        try:
            self.click(self.xs_loc)
        except Exception as e:
            print(e)





    def zxh(self):
        """
        最小化
        :return:
        """
        try:
            self.click(self.zxh_loc)
        except Exception as e:
            print(e)